home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 19.zip / BS1 part 19 / how to learn assembler.adf / CH4 / 4_3_3Ahex-ascii.asm < prev    next >
Assembly Source File  |  1988-02-25  |  509b  |  20 lines

  1. ;(4.3.3A) ascii-hex
  2.     move.l    #string,a0     ;pointer to string with  B in A0
  3.     jsr       nibblein
  4.     nop
  5.  
  6.  
  7. nibblein:                ; Convert the nibble from (A0)
  8.     clr.l     d0         ; Erase D0
  9.     move.b    (a0)+,d0   ; Get digit, increment A0
  10.     sub       #'A',d0    ; Subtract $41
  11.     bcc       ischar     ; No problem, in the range A-F
  12.     add       #7,d0      ; Else correct value
  13.  
  14. ischar:
  15.     add       #10,d0     ; Correct value
  16.     rts
  17.  
  18. string: dc.b 'B',0       ;char to convert
  19.    end
  20.